os: linux

dist: jammy

language: c

cache: ccache

addons:
    apt:
        packages:
        - sudo
        - libc-dev
        - bison
        - flex
        - libreadline-dev
        - zlib1g-dev
        - libzstd-dev
        - libssl-dev
        - perl
        - libperl-dev
        - libdbi-perl
        - cpanminus
        - locales
        - python3
        - python3-dev
        - python3-pip
        - libicu-dev
        - libgss-dev
        - libkrb5-dev
        - libxml2-dev
        - libxslt1-dev
        - libldap2-dev
        - tcl-dev
        - diffutils
        - gdb
        - gettext
        - lcov
        - openssh-client
        - openssh-server
        - libipc-run-perl
        - libtime-hires-perl
        - libtimedate-perl
        - libdbd-pg-perl

before_install:
    - sudo travis/before-install.sh

install:
    - travis/install.sh

before_script:
    - sudo travis/before-script.sh
    - travis/before-script-user.sh

script:
    - travis/script.sh

notifications:
    email:
        on_success: change
        on_failure: always

# Default MODE is basic, i.e. all tests with PG_PROBACKUP_TEST_BASIC=ON
env:
    - PG_VERSION=16 PG_BRANCH=master PTRACK_PATCH_PG_BRANCH=master
    - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=REL_15_STABLE
    - PG_VERSION=14 PG_BRANCH=REL_14_STABLE PTRACK_PATCH_PG_BRANCH=REL_14_STABLE
    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE
    - PG_VERSION=12 PG_BRANCH=REL_12_STABLE PTRACK_PATCH_PG_BRANCH=REL_12_STABLE
    - PG_VERSION=11 PG_BRANCH=REL_11_STABLE PTRACK_PATCH_PG_BRANCH=REL_11_STABLE
    - PG_VERSION=10 PG_BRANCH=REL_10_STABLE
    - PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE
    - PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE
    - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup
    - PG_VERSION=15 PG_BRANCH=REL_15_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=backup_test.BackupTest.test_full_backup_stream
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=checkdb
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=compression
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=merge
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=option
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=page
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=ptrack
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=replica
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=retention
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=restore
#    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=time_consuming

jobs:
    allow_failures:
        - if: env(PG_BRANCH) = master
        - if: env(PG_BRANCH) = REL9_5_STABLE
#       - if: env(MODE) IN (archive, backup, delta, locking, merge, replica, retention, restore)

# Only run CI for master branch commits to limit our travis usage
#branches:
#    only:
#    - master

